<html>
<head>
<title>E-mail confirmations<title>
<meta http-equiv="REFRESH" content="2;url=testform.php">
</head>
<body>

<?php

  $connection = mysql_connect( "localhost", "root", "abc123" );
  
  if ( !$connection )
  {
    die( 'Could not connect: ' . mysql_error() );
  }  
  
  mysql_select_db( "sasystemTables", $connection );

  $k = 0;

  foreach( $_GET as $value )
  {
    if ( $k % 2 == 0 )
    {
      $studentID = $value;
    }
    else
    {
      if ( $value != "notAssigned" )
      {
        $teacherID = $value;
        $query = "INSERT INTO Assignments ( userID, teacherID ) VALUES ( '$studentID', '$teacherID' );";
        $result = mysql_query( $query, $connection );
      }
    }

    $k++;
  }

  mysql_close( $connection );

?>

</body>
</html>